package lcy.code3;

import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Paths;
import java.util.Scanner;

/**
 * @ClassName: FileInOut
 * @Description:
 * @author: 李春洋
 * @date: 2024/5/13 16:23
 * @Blog: https://
 */
public class FileInOut {
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(Paths.get("D:\\temp\\mytest.txt"), "gbk");
        PrintStream toFile = new PrintStream("D:\\temp\\mytest2.txt", "utf-8");
        toFile.println("这是一个新闻报道，讲述了一个事实。");
        while (in.hasNextLine())
            toFile.print(in.nextLine());
    }
}
